package com.example.easycharge.controller;

import com.alibaba.fastjson.JSONObject;
import com.example.easycharge.entity.Vehicle;
import com.example.easycharge.repository.VehicleRepository;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Tag(name = "车辆接口组")
@Slf4j
@RestController
@RequestMapping("vehicle")
public class VehicleController {
    @Autowired
    private VehicleRepository vehicleRepository;

    @Operation(description = "查询车辆信息的接口，会做鉴权判断是不是自己的车子")
    @Parameter(description = "需要查询的车辆的编号")
    @GetMapping("/{vehicleId}")
    public Vehicle findVehicleDetail(@PathVariable("vehicleId") long vehicleId) {
        return vehicleRepository.findVehicleByVehicleId(vehicleId);
    }


}
